package org.deng.learn.designpattern.simplefactory;

/**
 * @author DengLibin
 * @Description
 * @Date 2019/2/12 0012 13:51
 */
public class BruitFactory {

    /**
     * 根据参数创建不同的对象实例
     * @param color
     * @return
     */
    public static Bruit createBruit(Color color){
        switch (color){
            case RED:
                return new Apple();
            case YELLOW:
                return new Banana();
        }
        throw new RuntimeException("参数错误");
    }
}
